public class WaitTest {
	public static void main(String[] args) {
		Thread thread1 = new Thread(new Runnable() {
			@Override
			public void run() {
				System.out.println("Warning:(3, 24) Instantiating a 'Thread' with default 'run()' method");
			}
		},"thread1");
		Object obj = new Object();

//		synchronized(this) {
//		synchronized(obj) {
//		synchronized(thread1) {   git提交时Warning:(8, 16) Synchronization on local variable 'thread1'
		synchronized(obj) {
			try {
				System.out.println(Thread.currentThread().getName() + "启动线程thread1");
				thread1.start();

				System.out.println(Thread.currentThread().getName() + "调用wait()方法");
				thread1.wait();

				System.out.println(Thread.currentThread().getName() + "继续执行");

				System.out.println(Thread.currentThread().getName() + "0");
				thread1.join();
				System.out.println(Thread.currentThread().getName() + "1");

			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}


	}
}